﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Avaliacao
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");


            routes.MapRoute(
                "r1", // Route name
                "{cliente}/teste/questao/{idAvaliacao}/{step}", // URL with parameters
                new { controller = "Teste", action = "Questao", cliente = UrlParameter.Optional, idAvaliacao = UrlParameter.Optional, step = UrlParameter.Optional } // Parameter defaults
            );



            routes.MapRoute(
                "r2", // Route name
                "{cliente}/acesso", // URL with parameters
                new { controller = "Home", action = "Index",cliente = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r3", // Route name
                "{cliente}/Home/Login", // URL with parameters
                new { controller = "Home", action = "Login", cliente = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r4", // Route name
                "{cliente}/Teste/Index", // URL with parameters
                new { controller = "Teste", action = "Index", cliente = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r5", // Route name
                "{cliente}/Teste/Inicio/{id}", // URL with parameters
                new { controller = "Teste", action = "Inicio", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r6", // Route name
                "{cliente}/Teste/Resposta/{id}", // URL with parameters
                new { controller = "Teste", action = "Resposta", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r7", // Route name
                "{cliente}/Teste/Agradecimento/{id}", // URL with parameters
                new { controller = "Teste", action = "Agradecimento", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r8", // Route name
                "{cliente}/Teste/AvaliacaoConcluida/{id}", // URL with parameters
                new { controller = "Teste", action = "AvaliacaoConcluida", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
                "r9", // Route name
                "{cliente}/Teste/SemAvaliacao/{id}", // URL with parameters
                new { controller = "Teste", action = "SemAvaliacao", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "r12", // Route name
                "{cliente}/Relatorio/Desempenho/{idAvaliacao}", // URL with parameters
                new { controller = "Relatorio", action = "Desempenho", cliente = UrlParameter.Optional, idAvaliacao = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
               "r13", // Route name
               "{cliente}/Gestao/{action}/{id}", // URL with parameters
               new { controller = "Gestao", action = "Index", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
           );

            routes.MapRoute(
                "r10", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );






            //routes.MapRoute(
            //    "Questoes", // Route name
            //    "teste/questao/{idAvaliacao}/{step}", // URL with parameters
            //    new { controller = "Teste", action = "Questao", idAvaliacao = UrlParameter.Optional, step = UrlParameter.Optional } // Parameter defaults
            //);

            //routes.MapRoute(
            //    "Cliente", // Route name
            //    "{cliente}/{controller}/{action}/{id}", // URL with parameters
            //    new { controller = "Home", action = "Index", cliente = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
            //);



        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}